package org.example.Study.login.controller;

import org.example.Study.login.service.LoginService;
import org.example.model.admin.pojo.AdminDto;
import org.example.model.commons.dtos.ResponseResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import javax.annotation.Resource;

/**
 * @Author : zhangbo
 * @data : 2024/3/26
 * @description :
 */
@RestController
@RequestMapping(value = "/admin")
public class LoginController {
    @Resource
    private LoginService loginService;

    /**
     * 用户是否注册
     * @param dto
     * @return
     */
    @PostMapping("/register")
    public ResponseResult register(@RequestBody AdminDto dto) {
        return loginService.register(dto);
    }

    /**
     * 用户登录
     * @param dto
     * @return
     */
    @PostMapping("/login")
    public ResponseResult login(@RequestBody AdminDto dto) {
        return loginService.login(dto);
    }
}
